﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace BaseCoder
{
    public class ProjectConfig
    {
        private Configuration config;
        public ProjectConfig(string project)
        {
            ExeConfigurationFileMap file = new ExeConfigurationFileMap();
#if Debug
            file.ExeConfigFilename = @"..\..\ProjectXml\" + project + ".config";
#else
            file.ExeConfigFilename = @"..\..\ProjectXml\" + project + ".config";
#endif
            config = ConfigurationManager.OpenMappedExeConfiguration(file, ConfigurationUserLevel.None);

        }
        public string ConectionString { get { return config.ConnectionStrings.ConnectionStrings["Database"].ConnectionString; } }

        public string this[string key]
        {
            get
            {
                return config.AppSettings.Settings[key].Value;
            }
        }
    }
}
